"""
    1. 一些对于算法的测试函数
    2. 
"""
import time
from random import randint

import platform


def myComputerVersion():
    os = platform.system()
    return {
        "system":os,
        "version":platform.platform(),
        "32/64":platform.architecture()[0],
        "computerName":platform.node(),
        "machineInfo":platform.machine()
    }


def timer():
    """
    this is a Efficiency function
    :return:
    """
    def wraps(func):
        def mesure(*args,**kwargs):
            start = time.time()
            res = func(*args,**kwargs)
            end = time.time()
            print("function %s use time %s"%(func.__name__,(end-start)))
            return res
        return mesure
    return wraps


def generateRandomArray(n,rangeL,ranger):
    arr = []
    for i in range(n):
        arr.append(randint(rangeL,ranger))
    return arr


def isSorted(arr):
    for i in range(len(arr)):
        if (arr[i] < arr[i+1]):
            return True
    return False

if __name__ == '__main__':
    print(generateRandomArray(20,1,10))
    print(myComputerVersion())